package com.stek.admin;

import android.app.admin.DeviceAdminReceiver;
import android.content.Context;
import android.content.Intent;

import com.stek.R;
import com.stek.utils.SharePreferenceUtils;

public class DeviceReceiver extends DeviceAdminReceiver {
	public DeviceReceiver() {
	}

	@Override
	public void onEnabled(Context context, Intent intent) {
		SharePreferenceUtils.putPrefBoolean(context,
				context.getString(R.string.key_lock), true);
		super.onEnabled(context, intent);
	}

	@Override
	public void onDisabled(Context context, Intent intent) {
		SharePreferenceUtils.putPrefBoolean(context,
				context.getString(R.string.key_lock), false);
		super.onDisabled(context, intent);
	}

	@Override
	public void onReceive(Context context, Intent intent) {
		String action = intent.getAction();
		if (DeviceAdminReceiver.ACTION_DEVICE_ADMIN_ENABLED.equals(action)) {
			SharePreferenceUtils.putPrefBoolean(context,
					context.getString(R.string.key_lock), true);

		}

	}

}
